'\" te
.\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH PLOCKSTAT 8 "May 23, 2020"
.SH NAME
plockstat \- report user-level lock statistics
.SH SYNOPSIS
.nf
\fBplockstat\fR [\fB-vACHV\fR] [\fB-n\fR \fIcount\fR] [\fB-s\fR \fIdepth\fR] [\fB-e\fR \fIsecs\fR]
     [\fB-x\fR \fIarg\fR [=val]] \fIcommand\fR [\fIarg\fR]...
.fi

.LP
.nf
\fBplockstat\fR [\fB-vACHV\fR] [\fB-n\fR \fIcount\fR] [\fB-s\fR \fIdepth\fR] [\fB-e\fR \fIsecs\fR]
     [\fB-x\fR \fIarg\fR [=val]] \fB-p\fR \fIpid\fR
.fi

.SH DESCRIPTION
The \fBplockstat\fR utility gathers and displays user-level locking statistics.
By default, \fBplockstat\fR monitors all lock contention events, gathers
frequency and timing data about those events, and displays the data in
decreasing frequency order, so that the most common events appear first.
.sp
.LP
\fBplockstat\fR gathers data until the specified command completes or the
process specified with the \fB-p\fR option completes.
.sp
.LP
\fBplockstat\fR relies on DTrace to instrument a running process or a command
it invokes to trace events of interest. This imposes a small but measurable
performance overhead on the processes being observed. Users must have the
\fBdtrace_proc\fR privilege and have permission to observe a particular process
with \fBplockstat\fR. Refer to the \fIDynamic Tracing Guide\fR for more
information about DTrace security features.
.SH OPTIONS
The following options are supported:
.sp
.ne 2
.na
\fB\fB-A\fR\fR
.ad
.RS 16n
Watch all lock events. This option is equivalent to \fB-CH\fR.
.RE

.sp
.ne 2
.na
\fB\fB-C\fR\fR
.ad
.RS 16n
Watch contention events.
.RE

.sp
.ne 2
.na
\fB\fB-H\fR\fR
.ad
.RS 16n
Watch hold events.
.RE

.sp
.ne 2
.na
\fB\fB-e\fR \fIsecs\fR\fR
.ad
.RS 16n
Exit after the number of seconds specified have elapsed.
.RE

.sp
.ne 2
.na
\fB\fB-n\fR \fIcount\fR\fR
.ad
.RS 16n
Display only the specified number of entries for each output category.
.RE

.sp
.ne 2
.na
\fB\fB-s\fR \fIdepth\fR\fR
.ad
.RS 16n
Record a stack trace rather than just the calling function.
.RE

.sp
.ne 2
.na
\fB\fB-p\fR \fIpid\fR\fR
.ad
.RS 16n
Specify a process ID from which \fBplockstat\fR is to gather data.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 16n
Print out a message to indicate that tracing has started.
.RE

.sp
.ne 2
.na
\fB\fB-x\fR \fIarg\fR[=\fIval\fR]\fR
.ad
.RS 16n
Enable or modify a DTrace runtime option or D compiler option. The list of
options is found in the \fIDynamic Tracing Guide\fR. Boolean options
are enabled by specifying their name. Options with values are set by separating
the option name and value with an equals sign (\fB=\fR).
.RE

.sp
.ne 2
.na
\fB\fB-V\fR\fR
.ad
.RS 16n
Print the DTrace commands used to gather the data. The output can then be used
directly with the \fBdtrace\fR(8) command.
.RE

.SH OPERANDS
The following operands are supported:
.sp
.ne 2
.na
\fB\fIarg\fR\fR
.ad
.RS 11n
A string to be passed as an argument to \fIcommand\fR.
.RE

.sp
.ne 2
.na
\fB\fIcommand\fR\fR
.ad
.RS 11n
The name of a utility to be invoked.
.RE

.sp
.ne 2
.na
\fB\fIcount\fR\fR
.ad
.RS 11n
A positive integer value.
.RE

.sp
.ne 2
.na
\fB\fIpid\fR\fR
.ad
.RS 11n
A process identifier for a process to be monitored.
.RE

.sp
.ne 2
.na
\fB\fIsecs\fR\fR
.ad
.RS 11n
Duration specified as a positive integer number of seconds.
.RE

.SH EXIT STATUS
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 6n
Successful completion.
.RE

.sp
.ne 2
.na
\fB>\fB0\fR\fR
.ad
.RS 6n
An error occurred.
.RE

.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	See below.
.TE

.sp
.LP
The command-line syntax is Evolving. The human-readable output is Unstable.
.SH SEE ALSO
.BR mutex_init (3C),
.BR pthread_mutex_lock (3C),
.BR pthread_rwlock_rdlock (3C),
.BR pthread_rwlock_unlock (3C),
.BR pthread_rwlock_wrlock (3C),
.BR rwlock (3C),
.BR fasttrap (4D),
.BR attributes (7),
.BR dtrace (8),
.BR lockstat (8)
.sp
.LP
\fIDynamic Tracing Guide\fR:
.sp
.LP
https://illumos.org/books/dtrace/
